cd  "__YOUR PATH HERE__"
use  "__DATA SET HERE__", clear


matrix drop _all
graph drop _all
estimates drop _all

label var washhands_w1 "Washed Hands More"
label var boughtsanitizer_w1 "Bought Sanitizer"
label var visitdoctor_w1 "Visited the Doctor"
label var changedtravel_w1 "Changed Travel Plans"
label var avoidcontact_w1 "Avoided Contact w/ Others"
label var avoidgatherings_w1 "Avoided Gatherings"
label var soughtinfo_w1 "Sought Info on COVID19"
label var selfquarantine_w1 "Self-Quarantined"
label var wearmask_w2 "Wear a Mask"


gen antitrump_w6 = .
replace antitrump_w6 = 0 if presvote20post_w6 == 2
replace antitrump_w6 = 1 if presvote20post_w6 == 1 
replace antitrump_w6 = 2 if presvote20post_w6 > 2 &  presvote20post_w6 < 7


gen stabletrump_12 = 1 if (antitrump_w1 == antitrump_w2) | (antitrump_w2 == .)
gen stabletrump_13 = 1 if (antitrump_w1 == antitrump_w3) | (antitrump_w3 == .)
gen stabletrump_14 = 1 if (antitrump_w1 == antitrump_w4) | (antitrump_w4 == .)
gen stabletrump_15 = 1 if (antitrump_w1 == antitrump_w5) | (antitrump_w5 == .)
gen stabletrump_16 = 1 if (antitrump_w1 == antitrump_w6) | (antitrump_w6 == .)

gen stabletrump = 1 if stabletrump_12 == 1 & stabletrump_13 == 1 & stabletrump_14 == 1 & stabletrump_15 == 1 & stabletrump_16 == 1



* summary statistics


preserve 

keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** agecat gender  inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** anger** anxiety** sadness** hope** disgust** cases** deaths**

gen ideology=ideology_w1
gen antitrump=antitrump_w1

putexcel set table_s1, replace

count if washhands_w1!=. & marstat!=.
local res = r(N)
putexcel B2=`res'
count if washhands_w2!=.
local res = r(N)
putexcel B3=`res'
count if washhands_w3!=.
local res = r(N)
putexcel B4=`res'
count if washhands_w4!=.
local res = r(N)
putexcel B5=`res'
count if washhands_w5!=.
local res = r(N)
putexcel B6=`res'
count if washhands_w6!=. & marstat!=.
local res = r(N)
putexcel B7=`res'

* response rates from YouGov
putexcel C2=39.6
putexcel C3=64.8
putexcel C4=51.9
putexcel C5=83.3
putexcel C6=50.8
putexcel C7=54.2

putexcel save



reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w anger_w anxiety_w sadness_w hope_w disgust_w antitrump_w ideology_w democrat_w pid7_w unemployed_w , i(caseid) j(wave)

drop if gender==.
drop if wave!=1

asdoc tabulate agecat , save(table_s4.doc) replace
asdoc tabulate gender , save(table_s4.doc) append
asdoc tabulate race4 , save(table_s4.doc) append
asdoc tabulate inc4 , save(table_s4.doc) append
asdoc tabulate educ4 , save(table_s4.doc) append
asdoc tabulate marstat , save(table_s4.doc) append
asdoc tabulate unemployed , save(table_s4.doc) append
asdoc tabulate inputstate , save(table_s4.doc) append
asdoc tabulate ruralcode , save(table_s4.doc) append

asdoc sum washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w, save(table_s2.doc) replace

asdoc tabulate democrat ideology, mi chi2 save(table_s3.doc) replace
asdoc tabulate democrat antitrump, chi2 save(table_s3.doc) append
asdoc tabulate ideology antitrump, chi2 save(table_s3.doc) append

restore

preserve 
reshape long cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w , i(caseid) j(wave)

asdoc sum cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, save(table_s4.doc) append

restore


preserve 

keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** agecat gender  inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** anger** anxiety** sadness** hope** disgust** cases** deaths**

reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w anger_w anxiety_w sadness_w hope_w disgust_w antitrump_w ideology_w democrat_w pid7_w unemployed_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w , i(caseid) j(wave)

drop if gender==.
drop if wave!=2

asdoc sum wearmask_w, save(table_s2.doc) append

restore


preserve


*** FIGURE 1: UNADJUSTED PROPORTIONS


	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** caseid
	
	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w , i(caseid) j(wave)
	
	collapse (mean) wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w, by(antitrump_w wave)
	
	drop if antitrump_w == .
	
	label var washhands_w "Washed Hands More"
	label var boughtsanitizer_w "Bought Sanitizer"
	label var visitdoctor_w "Visited the Doctor"
	label var changedtravel_w "Changed Travel Plans"
	label var avoidcontact_w "Avoided Contact with Others"
	label var avoidgatherings_w "Avoided Gatherings"
	label var soughtinfo_w "Sought Information on COVID"
	label var selfquarantine_w "Self-Quarantined"
	label var wearmask_w "Wore a Mask"

	
	recode wave (1=1) (2=32) (3=89) (4=138) (5=200) (6=370)
	xtset antitrump_w wave
	
	local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine wearmask"
	local i = 1
	foreach var of local dvs {
 
		local l`var' : variable label `var'_w

		summarize `var'_w if antitrump==0 & wave==370
		local trumpspot = r(mean)
		summarize `var'_w  if antitrump==1 & wave==370
		local antispot = r(mean)
		if `i'==9 {
			summarize `var'_w  if antitrump==2 & wave==32
			local otherspot = r(mean)
			
			tsline `var'_w  if antitrump==0, lcolor(black) || ///
			tsline `var'_w  if antitrump==1, lcolor(black) lpattern(dash) || ///
			tsline `var'_w  if antitrump==2, lcolor(black) lpattern(longdash) xtitle(Wave) xscale(r(-30 400)) ///
			ylabel(0(.2)1) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6") legend(off) ytitle(Proportion) ///
			text(`trumpspot' 371 "Trump", placement(e) size(vsmall)) ///
			text(`antispot' 371 "Biden", placement(e) size(vsmall)) ///
			text(`otherspot' 31 "O/A", placement(w) size(vsmall)) name(`var', replace) ///
			title({bf:`l`var''}, size(medsmall))
		}
		else {
			summarize `var'_w  if antitrump==2 & wave==1
			local otherspot = r(mean)
		
			tsline `var'_w  if antitrump==0, lcolor(black) || ///
			tsline `var'_w  if antitrump==1, lcolor(black) lpattern(dash) || ///
			tsline `var'_w  if antitrump==2, lcolor(black) lpattern(longdash) xtitle(Wave) xscale(r(-30 400)) ///
			ylabel(0(.2)1) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6") legend(off) ytitle(Proportion) ///
			text(`trumpspot' 371 "Trump", placement(e) size(vsmall)) ///
			text(`antispot' 371 "Biden", placement(e) size(vsmall)) ///
			text(`otherspot' 0 "O/A", placement(w) size(vsmall)) name(`var', replace) ///
			title({bf:`l`var''}, size(medsmall))
		}
		local i = `i' + 1
	}
	
	graph combine washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine wearmask, rows(3) iscale(.6) ysize(7) xsize(6.5) ycommon

graph export "figure1.pdf", as(pdf) replace
graph export "figure1.png", as(png) replace

restore



*** FIGURE 2, FIGURE S2, FIGURE S3, FIGURE S4: PARTISANSHIP AND IDEOLOGY AND TRUMP SUPPORT


putexcel set results_behavior_ideotrump, sheet(partisanship) replace

putexcel A2="Democrats v. Republicans: Wave 1"
putexcel A4="Democrats v. Republicans: Wave 2"
putexcel A6="Democrats v. Republicans: Wave 3"
putexcel A8="Democrats v. Republicans: Wave 4"
putexcel A10="Democrats v. Republicans: Wave 5"
putexcel A12="Democrats v. Republicans: Wave 6"

putexcel A15="Others v. Republicans: Wave 1"
putexcel A17="Others v. Republicans: Wave 2"
putexcel A19="Others v. Republicans: Wave 3"
putexcel A21="Others v. Republicans: Wave 4"
putexcel A23="Others v. Republicans: Wave 5"
putexcel A25="Others v. Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump, sheet(trump) modify

putexcel A2="Vote for Democrat v. Vote for Trump: Wave 1"
putexcel A4="Vote for Democrat v. Vote for Trump: Wave 2"
putexcel A6="Vote for Democrat v. Vote for Trump: Wave 3"
putexcel A8="Vote for Democrat v. Vote for Trump: Wave 4"
putexcel A10="Vote for Democrat v. Vote for Trump: Wave 5"
putexcel A12="Vote for Democrat v. Vote for Trump: Wave 6"

putexcel A15="Vote for Third Party/Abstain v. Vote for Trump: Wave 1"
putexcel A17="Vote for Third Party/Abstain v. Vote for Trump: Wave 2"
putexcel A19="Vote for Third Party/Abstain v. Vote for Trump: Wave 3"
putexcel A21="Vote for Third Party/Abstain v. Vote for Trump: Wave 4"
putexcel A23="Vote for Third Party/Abstain v. Vote for Trump: Wave 5"
putexcel A25="Vote for Third Party/Abstain v. Vote for Trump: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump, sheet(ideology) modify

putexcel A2="Liberal v. Conservative: Wave 1"
putexcel A4="Liberal v. Conservative: Wave 2"
putexcel A6="Liberal v. Conservative: Wave 3"
putexcel A8="Liberal v. Conservative: Wave 4"
putexcel A10="Liberal v. Conservative: Wave 5"
putexcel A12="Liberal v. Conservative: Wave 6"

putexcel A15="Moderate v. Conservative: Wave 1"
putexcel A17="Moderate v. Conservative: Wave 2"
putexcel A19="Moderate v. Conservative: Wave 3"
putexcel A21="Moderate v. Conservative: Wave 4"
putexcel A23="Moderate v. Conservative: Wave 5"
putexcel A25="Moderate v. Conservative: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save



local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w  democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	* predicted probabilities, for the body 
	
	gen wave2=wave
	recode wave2 (1=1) (2=32) (3=89) (4=138) (5=200) (6=370)

	melogit `var' i.democrat##i.wave2 i.ideology##i.wave2 i.antitrump##i.wave2 i.agecat##i.wave2 i.unemployed##i.wave2 i.race4##i.wave2 i.inc4##i.wave2 i.educ4##i.wave2 i.marstat##i.wave2 i.gender##i.wave2 i.inputstate##i.wave2 i.ruralcode##i.wave2 c.cases_growth_w##i.wave2 c.cases_growth_pc##i.wave2 c.deaths_growth_w##i.wave2 c.deaths_growth_pc##i.wave2 || caseid: 
	
	eststo res_`var'

	margins, at(antitrump=(0 1 2) wave2=(32 89 138 200 370)) nose noestimcheck force
	local repspot = r(table)[1,13]
	local demspot = r(table)[1,14]
	local othspot = r(table)[1,15]
	marginsplot, xscale(r(1 450)) __swapxp plotopts(mcolor(black) msymbol(none) lcolor(black) legend(off)) plot2opts(lpattern(dash)) plot3opts(lpattern(longdash)) ///
	text(`repspot' 371 "Trump", placement(e) size(vsmall)) text(`demspot' 371 "Biden", placement(e) size(vsmall)) text(`othspot' 371 "O/A", placement(e) size(vsmall)) ///
	xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6") xtitle(Wave) title({bf:`l`var''}, size(medsmall)) ytitle(Probability) name(`var'_mu_t, replace)

	* marginal effects, for the appendix

	melogit `var' i.democrat##i.wave i.ideology##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
		
	putexcel set results_behavior_ideotrump, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6")) 

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore

}



	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w1

	keep washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	* predicted probabilities, for the body 
	
	gen wave2=wave
	recode wave2 (1=1) (2=32) (3=89) (4=138) (5=200) (6=370)

	melogit `var' i.democrat##i.wave2 i.ideology##i.wave2 i.antitrump##i.wave2 i.agecat##i.wave2 i.unemployed##i.wave2 i.race4##i.wave2 i.inc4##i.wave2 i.educ4##i.wave2 i.marstat##i.wave2 i.gender##i.wave2 i.inputstate##i.wave2 i.ruralcode##i.wave2 c.cases_growth_w##i.wave2 c.cases_growth_pc##i.wave2 c.deaths_growth_w##i.wave2 c.deaths_growth_pc##i.wave2 || caseid: 
	
	eststo res_`var'


		margins, at(antitrump=(0 1 2) wave2=(1 32 89 138 200 370)) nose noestimcheck force
	local repspot = r(table)[1,16]
	local demspot = r(table)[1,17]
	local othspot = r(table)[1,18]
	marginsplot, xscale(r(1 450)) __swapxp plotopts(mcolor(black) msymbol(none) lcolor(black) legend(off)) plot2opts(lpattern(dash)) plot3opts(lpattern(longdash)) ///
	text(`repspot' 371 "Trump", placement(e) size(vsmall)) text(`demspot' 371 "Biden", placement(e) size(vsmall)) text(`othspot' 371 "O/A", placement(e) size(vsmall)) ///
	xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6") xtitle(Wave) title({bf:`l`var''}, size(medsmall)) ytitle(Probability) name(`var'_mu_t, replace)

	* marginal effects, for the appendix
	
	melogit `var' i.democrat##i.wave i.ideology##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
	
	eststo `var'
	
	putexcel set results_behavior_ideotrump, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))		
		
	restore
	
	local mod = `mod'+1

}


grc1leg washhands_d avoidgatherings_d avoidcontact_d soughtinfo_d boughtsanitizer_d selfquarantine_d changedtravel_d visitdoctor_d wearmask_d, rows(3) 
graph export "figureS2.pdf", as(pdf) replace
graph export "figureS2.png", as(png) replace


grc1leg washhands_i avoidgatherings_i avoidcontact_i soughtinfo_i boughtsanitizer_i selfquarantine_i changedtravel_i visitdoctor_i wearmask_i, rows(3) 
graph export "figureS4.pdf", as(pdf) replace
graph export "figureS4.png", as(png) replace


grc1leg washhands_t avoidgatherings_t avoidcontact_t soughtinfo_t boughtsanitizer_t selfquarantine_t changedtravel_t visitdoctor_t wearmask_t, rows(3) 
graph export "figureS3.pdf", as(pdf) replace
graph export "figureS3.png", as(png) replace


graph combine washhands_mu_t avoidgatherings_mu_t avoidcontact_mu_t soughtinfo_mu_t boughtsanitizer_mu_t selfquarantine_mu_t changedtravel_mu_t visitdoctor_mu_t wearmask_mu_t, rows(3) iscale(.6) ysize(7) xsize(6.5) ycommon

graph export "figure2.pdf", as(pdf) replace
graph export "figure2.png", as(png) replace


esttab res* using table_s5.csv, cells(b(fmt(2) nostar) se(fmt(2) par) p(fmt(2))) nobaselevels nogaps compress replace
esttab res*, nobaselevels nogaps compress cells(b(fmt(2) nostar) se(fmt(2) par) p(fmt(2))) 




*** FIGURE S1: PARTISANSHIP ALONE

putexcel set results_behavior, replace

putexcel A2="Democrats v. Republicans: Wave 1"
putexcel A4="Democrats v. Republicans: Wave 2"
putexcel A6="Democrats v. Republicans: Wave 3"
putexcel A8="Democrats v. Republicans: Wave 4"
putexcel A10="Democrats v. Republicans: Wave 5"
putexcel A12="Democrats v. Republicans: Wave 6"

putexcel A15="Others v. Republicans: Wave 1"
putexcel A17="Others v. Republicans: Wave 2"
putexcel A19="Others v. Republicans: Wave 3"
putexcel A21="Others v. Republicans: Wave 4"
putexcel A23="Others v. Republicans: Wave 5"
putexcel A25="Others v. Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save



local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	* predicted probabilities, for the body 
	
	gen wave2=wave
	recode wave2 (1=1) (2=32) (3=89) (4=138) (5=200) (6=370)

	* marginal effects, for the appendix	
	melogit `var' i.democrat##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave  || caseid: 

	eststo `var'
	
	putexcel set results_behavior, modify
	

	local col = word( "`c(ALPHA)'" , `mod' )
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,6,.)
	
	display "`col'1"
		
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 0.democrat + 0.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'

	drop `var'*
	svmat `var'

	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var', replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
	
	restore
	
}





	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w1

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**

	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	* predicted probabilities, for the body 
	
	gen wave2=wave
	recode wave2 (1=1) (2=32) (3=89) (4=138) (5=200) (6=370)


	* marginal effects, for the appendix	
	melogit `var' i.democrat##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
	

	eststo `var'
	
	putexcel set results_behavior, modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,6,.)
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
	}
	
	putexcel save
	
	matrix list `var'

	drop `var'*
	svmat `var'

	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var', replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
	
	restore 
	
	local mod = `mod'+1

}

grc1leg washhands avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor wearmask, rows(3) 

graph export "figureS1.pdf", as(pdf) replace
graph export "figureS1.png", as(png) replace






*** FIGURE S5, FIGURE S6, FIGURE S7: PARTISANSHIP AND IDEOLOGY AND TRUMPINESS, EACH TIME VARYING FOR ROBUSTNESS


putexcel set results_behavior_ideotrump_tv, sheet(partisanship) replace

putexcel A2="Democrats v. Republicans: Wave 1"
putexcel A4="Democrats v. Republicans: Wave 2"
putexcel A6="Democrats v. Republicans: Wave 3"
putexcel A8="Democrats v. Republicans: Wave 4"
putexcel A10="Democrats v. Republicans: Wave 5"
putexcel A12="Democrats v. Republicans: Wave 6"

putexcel A15="Others v. Republicans: Wave 1"
putexcel A17="Others v. Republicans: Wave 2"
putexcel A19="Others v. Republicans: Wave 3"
putexcel A21="Others v. Republicans: Wave 4"
putexcel A23="Others v. Republicans: Wave 5"
putexcel A25="Others v. Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_tv, sheet(trump) modify

putexcel A2="Vote for Democrat v. Vote for Trump: Wave 1"
putexcel A4="Vote for Democrat v. Vote for Trump: Wave 2"
putexcel A6="Vote for Democrat v. Vote for Trump: Wave 3"
putexcel A8="Vote for Democrat v. Vote for Trump: Wave 4"
putexcel A10="Vote for Democrat v. Vote for Trump: Wave 5"
putexcel A12="Vote for Democrat v. Vote for Trump: Wave 6"

putexcel A15="Vote for Third Party/Abstain v. Vote for Trump: Wave 1"
putexcel A17="Vote for Third Party/Abstain v. Vote for Trump: Wave 2"
putexcel A19="Vote for Third Party/Abstain v. Vote for Trump: Wave 3"
putexcel A21="Vote for Third Party/Abstain v. Vote for Trump: Wave 4"
putexcel A23="Vote for Third Party/Abstain v. Vote for Trump: Wave 5"
putexcel A25="Vote for Third Party/Abstain v. Vote for Trump: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_tv, sheet(ideology) modify

putexcel A2="Liberal v. Conservative: Wave 1"
putexcel A4="Liberal v. Conservative: Wave 2"
putexcel A6="Liberal v. Conservative: Wave 3"
putexcel A8="Liberal v. Conservative: Wave 4"
putexcel A10="Liberal v. Conservative: Wave 5"
putexcel A12="Liberal v. Conservative: Wave 6"

putexcel A15="Moderate v. Conservative: Wave 1"
putexcel A17="Moderate v. Conservative: Wave 2"
putexcel A19="Moderate v. Conservative: Wave 3"
putexcel A21="Moderate v. Conservative: Wave 4"
putexcel A23="Moderate v. Conservative: Wave 5"
putexcel A25="Moderate v. Conservative: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save




local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	melogit `var' i.democrat_w##i.wave i.ideology_w##i.wave i.antitrump_w##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
		
	eststo `var'

	putexcel set results_behavior_ideotrump_tv, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat_w + 1.democrat_w#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat_w + 2.democrat_w#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_tv, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology_w + 1.ideology_w#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology_w + 2.ideology_w#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_tv, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump_w + 1.antitrump_w#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump_w + 2.antitrump_w#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6")) 

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore

}



*** FOR REVIEWERS, NOT REPORTED: WAVE 5 AND 6 DATA ONLY, AVERAGE EFFECT OF TRUMPINESS

local dvs "wearmask washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	keep if wave>=5
	
	quietly logit `var' i.democrat_w##i.wave i.ideology_w##i.wave i.antitrump_w##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave 
		
	eststo `var'
	
	margins, dydx(antitrump_w)
	margins, dydx(ideology_w)
	margins, dydx(democrat_w)

	restore
	
	}
	
	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w1

	keep washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	melogit `var' i.democrat_w##i.wave i.ideology_w##i.wave i.antitrump_w##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
	
	eststo `var'
	
	putexcel set results_behavior_ideotrump_tv, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat_w + 1.democrat_w#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat_w + 2.democrat_w#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_tv, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology_w + 1.ideology_w#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology_w + 2.ideology_w#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_tv, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump_w + 1.antitrump_w#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump_w + 2.antitrump_w#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore
	
	local mod = `mod'+1

}


grc1leg washhands_i avoidgatherings_i avoidcontact_i soughtinfo_i boughtsanitizer_i selfquarantine_i changedtravel_i visitdoctor_i wearmask_i, rows(3) 

graph export "figureS5.pdf", as(pdf) replace
graph export "figureS5.png", as(png) replace


grc1leg washhands_d avoidgatherings_d avoidcontact_d soughtinfo_d boughtsanitizer_d selfquarantine_d changedtravel_d visitdoctor_d wearmask_d, rows(3) 

graph export "figureS6.pdf", as(pdf) replace
graph export "figureS6.png", as(png) replace


grc1leg washhands_t avoidgatherings_t avoidcontact_t soughtinfo_t boughtsanitizer_t selfquarantine_t changedtravel_t visitdoctor_t wearmask_t, rows(3) 

graph export "figureS7.pdf", as(pdf) replace
graph export "figureS7.png", as(png) replace




*** FIGURE S8, FIGURE S9, FIGURE S10: PARTISANSHIP AND IDEOLOGY AND TRUMPINESS, NOW LOOKING FOR EXTREME COMPARISONS


putexcel set results_behavior_ideotrump_strong, sheet(partisanship) replace

putexcel A2="Strong Democrats v. Strong Republicans: Wave 1"
putexcel A4="Strong Democrats v. Strong Republicans: Wave 2"
putexcel A6="Strong Democrats v. Strong Republicans: Wave 3"
putexcel A8="Strong Democrats v. Strong Republicans: Wave 4"
putexcel A10="Strong Democrats v. Strong Republicans: Wave 5"
putexcel A12="Strong Democrats v. Strong Republicans: Wave 6"

putexcel A15="All Others v. Strong Republicans: Wave 1"
putexcel A17="All Others v. Strong Republicans: Wave 2"
putexcel A19="All Others v. Strong Republicans: Wave 3"
putexcel A21="All Others v. Strong Republicans: Wave 4"
putexcel A23="All Others v. Strong Republicans: Wave 5"
putexcel A25="All Others v. Strong Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_strong, sheet(trump) modify

putexcel A2="Vote for Democrat v. Vote for Trump: Wave 1"
putexcel A4="Vote for Democrat v. Vote for Trump: Wave 2"
putexcel A6="Vote for Democrat v. Vote for Trump: Wave 3"
putexcel A8="Vote for Democrat v. Vote for Trump: Wave 4"
putexcel A10="Vote for Democrat v. Vote for Trump: Wave 5"
putexcel A12="Vote for Democrat v. Vote for Trump: Wave 6"

putexcel A15="Vote for Third Party/Abstain v. Vote for Trump: Wave 1"
putexcel A17="Vote for Third Party/Abstain v. Vote for Trump: Wave 2"
putexcel A19="Vote for Third Party/Abstain v. Vote for Trump: Wave 3"
putexcel A21="Vote for Third Party/Abstain v. Vote for Trump: Wave 4"
putexcel A23="Vote for Third Party/Abstain v. Vote for Trump: Wave 5"
putexcel A25="Vote for Third Party/Abstain v. Vote for Trump: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_strong, sheet(ideology) modify

putexcel A2="Very Liberal v. Very Conservative: Wave 1"
putexcel A4="Very Liberal v. Very Conservative: Wave 2"
putexcel A6="Very Liberal v. Very Conservative: Wave 3"
putexcel A8="Very Liberal v. Very Conservative: Wave 4"
putexcel A10="Very Liberal v. Very Conservative: Wave 5"
putexcel A12="Very Liberal v. Very Conservative: Wave 6"

putexcel A15="All Other v. Very Conservative: Wave 1"
putexcel A17="All Other v. Very Conservative: Wave 2"
putexcel A19="All Other v. Very Conservative: Wave 3"
putexcel A21="All Other v. Very Conservative: Wave 4"
putexcel A23="All Other v. Very Conservative: Wave 5"
putexcel A25="All Other v. Very Conservative: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save



local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** ideo5* cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1
	gen strongliberal = .
	replace strongliberal = 1 if ideo5==1
	replace strongliberal = 0 if ideo5==5
	replace strongliberal = 2 if ideo5==2 | ideo5==3 | ideo5==4 | ideo5==6
	gen strongdemocrat = .
	replace strongdemocrat = 1 if pid7_w1==1
	replace strongdemocrat = 0 if pid7_w1==7
	replace strongdemocrat = 2 if pid7_w1==2 | pid7_w1==3 | pid7_w1==4 | pid7_w1==5 | pid7_w1==6
	
	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	melogit `var' i.strongdemocrat##i.wave i.strongliberal##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
		
	eststo `var'

	putexcel set results_behavior_ideotrump_strong, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.strongdemocrat + 1.strongdemocrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.strongdemocrat + 2.strongdemocrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_strong, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.strongliberal + 1.strongliberal#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.strongliberal + 2.strongliberal#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_strong, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Strong Democrats v Strong Republicans" 2 "All Other v Strong Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Very Liberal v Very Conservative" 2 "All Other v Very Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6")) 

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore

}





	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w1

	keep washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** ideo5** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1
	gen strongliberal = .
	replace strongliberal = 1 if ideo5==1
	replace strongliberal = 0 if ideo5==5
	replace strongliberal = 2 if ideo5==2 | ideo5==3 | ideo5==4 | ideo5==6
	gen strongdemocrat = .
	replace strongdemocrat = 1 if pid7_w1==1
	replace strongdemocrat = 0 if pid7_w1==7
	replace strongdemocrat = 2 if pid7_w1==2 | pid7_w1==3 | pid7_w1==4 | pid7_w1==5 | pid7_w1==6
	
	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	melogit `var' i.strongdemocrat##i.wave i.strongliberal##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
	
	eststo `var'
	
	putexcel set results_behavior_ideotrump_strong, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.strongdemocrat + 1.strongdemocrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.strongdemocrat + 2.strongdemocrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_strong, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.strongliberal + 1.strongliberal#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.strongliberal + 2.strongliberal#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_strong, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Strong Democrats v Strong Republicans" 2 "All Other v Strong Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Very Liberal v Very Conservative" 2 "All Other v Very Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore
	
	local mod = `mod'+1

}




grc1leg washhands_d avoidgatherings_d avoidcontact_d soughtinfo_d boughtsanitizer_d selfquarantine_d changedtravel_d visitdoctor_d wearmask_d, rows(3)
graph export "figureS8.pdf", as(pdf) replace
graph export "figureS8.png", as(png) replace


grc1leg washhands_i avoidgatherings_i avoidcontact_i soughtinfo_i boughtsanitizer_i selfquarantine_i changedtravel_i visitdoctor_i wearmask_i, rows(3)
graph export "figureS9.pdf", as(pdf) replace
graph export "figureS9.png", as(png) replace


grc1leg washhands_t avoidgatherings_t avoidcontact_t soughtinfo_t boughtsanitizer_t selfquarantine_t changedtravel_t visitdoctor_t wearmask_t, rows(3) 
graph export "figureS10.pdf", as(pdf) replace
graph export "figureS10.png", as(png) replace








*** FIGURE S11, FIGURE S12, FIGURE S13: PARTISANSHIP AND IDEOLOGY AND TRUMPINESS, NOW TRUMP FAVORITISM


* cross-tab of Trumpism (vote intentions) and Trumpism (favorability)
preserve

gen trumpopinion = .
replace trumpopinion = 0 if q26 == 1
replace trumpopinion = 2 if q26 == 2 | q26 == 3
replace trumpopinion = 1 if q26 == 4

asdoc tabulate trumpopinion antitrump_w1, chi2 save(table_s6.doc) replace
	
restore



putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(partisanship) replace

putexcel A2="Democrats v. Republicans: Wave 1"
putexcel A4="Democrats v. Republicans: Wave 2"
putexcel A6="Democrats v. Republicans: Wave 3"
putexcel A8="Democrats v. Republicans: Wave 4"
putexcel A10="Democrats v. Republicans: Wave 5"
putexcel A12="Democrats v. Republicans: Wave 6"

putexcel A15="All Others v. Republicans: Wave 1"
putexcel A17="All Others v. Republicans: Wave 2"
putexcel A19="All Others v. Republicans: Wave 3"
putexcel A21="All Others v. Republicans: Wave 4"
putexcel A23="All Others v. Republicans: Wave 5"
putexcel A25="All Others v. Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(trump) modify

putexcel A2="Trump Unfavorable v. Trump Favorable: Wave 1"
putexcel A4="Trump Unfavorable v. Trump Favorable: Wave 2"
putexcel A6="Trump Unfavorable v. Trump Favorable: Wave 3"
putexcel A8="Trump Unfavorable v. Trump Favorable: Wave 4"
putexcel A10="Trump Unfavorable v. Trump Favorable: Wave 5"
putexcel A12="Trump Unfavorable v. Trump Favorable: Wave 6"

putexcel A15="Trump Mixed v. Trump Favorable: Wave 1"
putexcel A17="Trump Mixed v. Trump Favorable: Wave 2"
putexcel A19="Trump Mixed v. Trump Favorable: Wave 3"
putexcel A21="Trump Mixed v. Trump Favorable: Wave 4"
putexcel A23="Trump Mixed v. Trump Favorable: Wave 5"
putexcel A25="Trump Mixed v. Trump Favorable: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(ideology) modify

putexcel A2="Liberal v. Conservative: Wave 1"
putexcel A4="Liberal v. Conservative: Wave 2"
putexcel A6="Liberal v. Conservative: Wave 3"
putexcel A8="Liberal v. Conservative: Wave 4"
putexcel A10="Liberal v. Conservative: Wave 5"
putexcel A12="Liberal v. Conservative: Wave 6"

putexcel A15="All Other v. Conservative: Wave 1"
putexcel A17="All Other v. Conservative: Wave 2"
putexcel A19="All Other v. Conservative: Wave 3"
putexcel A21="All Other v. Conservative: Wave 4"
putexcel A23="All Other v. Conservative: Wave 5"
putexcel A25="All Other v. Conservative: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save


local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** ideo5* cases_growth_** deaths_growth_** q26
	
	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	gen trumpopinion = .
	replace trumpopinion = 0 if q26 == 1
	replace trumpopinion = 2 if q26 == 2 | q26 == 3
	replace trumpopinion = 1 if q26 == 4
	
	label var `var' "`l`var''"

	melogit `var' i.democrat##i.wave i.ideology##i.wave i.trumpopinion##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
		
	eststo `var'

	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.trumpopinion + 1.trumpopinion#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.trumpopinion + 2.trumpopinion#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Other v  Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6")) 

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Trump Unfavorable v Trump Favorable" 2 "Trump Mixed v Trump Favorable")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore

}



	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w1

	keep washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** ideo5** cases_growth_** deaths_growth_** q26
	
	label values democrat democrat 
	gen trumpopinion = .
	replace trumpopinion = 0 if q26 == 1
	replace trumpopinion = 2 if q26 == 2 | q26 == 3
	replace trumpopinion = 1 if q26 == 4
	
	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	melogit `var' i.democrat##i.wave i.ideology##i.wave i.trumpopinion##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave || caseid: 
	
	eststo `var'
	
	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_trumpfavoritism, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.trumpopinion + 1.trumpopinion#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.trumpopinion + 2.trumpopinion#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "All Other v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "All Other v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Trump Unfavorable v Trump Favorable" 2 "Trump Mixed v Trump Favorable")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore
	
	local mod = `mod'+1

}




grc1leg washhands_d avoidgatherings_d avoidcontact_d soughtinfo_d boughtsanitizer_d selfquarantine_d changedtravel_d visitdoctor_d wearmask_d, rows(3)
graph export "figureS11.pdf", as(pdf) replace
graph export "figureS11.png", as(png) replace


grc1leg washhands_i avoidgatherings_i avoidcontact_i soughtinfo_i boughtsanitizer_i selfquarantine_i changedtravel_i visitdoctor_i wearmask_i, rows(3)
graph export "figureS12.pdf", as(pdf) replace
graph export "figureS12.png", as(png) replace


grc1leg washhands_t avoidgatherings_t avoidcontact_t soughtinfo_t boughtsanitizer_t selfquarantine_t changedtravel_t visitdoctor_t wearmask_t, rows(3) 
graph export "figureS13.pdf", as(pdf) replace
graph export "figureS13.png", as(png) replace





*** FIGURE S14, FIGURE S15, FIGURE S16: PARTISANSHIP AND IDEOLOGY AND TRUMPINESS, FULL SAMPLE ONLY


putexcel set results_behavior_ideotrump_noattrition, sheet(partisanship) replace

putexcel A2="Democrats v. Republicans: Wave 1"
putexcel A4="Democrats v. Republicans: Wave 2"
putexcel A6="Democrats v. Republicans: Wave 3"
putexcel A8="Democrats v. Republicans: Wave 4"
putexcel A10="Democrats v. Republicans: Wave 5"
putexcel A12="Democrats v. Republicans: Wave 6"

putexcel A15="Others v. Republicans: Wave 1"
putexcel A17="Others v. Republicans: Wave 2"
putexcel A19="Others v. Republicans: Wave 3"
putexcel A21="Others v. Republicans: Wave 4"
putexcel A23="Others v. Republicans: Wave 5"
putexcel A25="Others v. Republicans: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_noattrition, sheet(trump) modify

putexcel A2="Vote for Democrat v. Vote for Trump: Wave 1"
putexcel A4="Vote for Democrat v. Vote for Trump: Wave 2"
putexcel A6="Vote for Democrat v. Vote for Trump: Wave 3"
putexcel A8="Vote for Democrat v. Vote for Trump: Wave 4"
putexcel A10="Vote for Democrat v. Vote for Trump: Wave 5"
putexcel A12="Vote for Democrat v. Vote for Trump: Wave 6"

putexcel A15="Vote for Third Party/Abstain v. Vote for Trump: Wave 1"
putexcel A17="Vote for Third Party/Abstain v. Vote for Trump: Wave 2"
putexcel A19="Vote for Third Party/Abstain v. Vote for Trump: Wave 3"
putexcel A21="Vote for Third Party/Abstain v. Vote for Trump: Wave 4"
putexcel A23="Vote for Third Party/Abstain v. Vote for Trump: Wave 5"
putexcel A25="Vote for Third Party/Abstain v. Vote for Trump: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save

putexcel set results_behavior_ideotrump_noattrition, sheet(ideology) modify

putexcel A2="Liberal v. Conservative: Wave 1"
putexcel A4="Liberal v. Conservative: Wave 2"
putexcel A6="Liberal v. Conservative: Wave 3"
putexcel A8="Liberal v. Conservative: Wave 4"
putexcel A10="Liberal v. Conservative: Wave 5"
putexcel A12="Liberal v. Conservative: Wave 6"

putexcel A15="Moderate v. Conservative: Wave 1"
putexcel A17="Moderate v. Conservative: Wave 2"
putexcel A19="Moderate v. Conservative: Wave 3"
putexcel A21="Moderate v. Conservative: Wave 4"
putexcel A23="Moderate v. Conservative: Wave 5"
putexcel A25="Moderate v. Conservative: Wave 6"

putexcel A28="Odds ratios with standard errors in parentheses. * p < .05, ** < p .01, *** p < .001"

putexcel save



local dvs "wearmask"
local mod=10
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	keep if `var'_w2 !=. &  `var'_w3 !=. &  `var'_w4 !=. &  `var'_w5 !=. &  `var'_w6 !=.
	 
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w6 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w  democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	melogit `var' i.democrat##i.wave i.ideology##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave [pw = weight_w6] || caseid: , difficult iterate(50)
		
	eststo `var'

	putexcel set results_behavior_ideotrump_noattrition, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_noattrition, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_noattrition, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 2/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6")) 

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore

}





	
local dvs "washhands boughtsanitizer visitdoctor changedtravel avoidcontact avoidgatherings soughtinfo selfquarantine"
local mod=2

estimates drop _all
foreach var of local dvs {

	preserve 
	
	keep if  `var'_w1 !=. & `var'_w2 !=. &  `var'_w3 !=. &  `var'_w4 !=. &  `var'_w5 !=. &  `var'_w6 !=.
	
	local l`var' : variable label `var'_w1

	keep washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w6 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**
	
	gen ideology=ideology_w1
	gen antitrump=antitrump_w1

	reshape long washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"
	
	melogit `var' i.democrat##i.wave i.ideology##i.wave i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave [pw = weight_w6] || caseid:  , difficult iterate(50)
	
	eststo `var'
	
	putexcel set results_behavior_ideotrump_noattrition, sheet(partisanship) modify
	matrix define `var' = (1 \ 32 \ 89 \ 138 \ 200 \ 370) , J(6,18,.)

	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.democrat + 1.democrat#`i'.wave, or
		matrix `var'[`i',2] = r(estimate)
		matrix `var'[`i',3] = r(lb)
		matrix `var'[`i',4] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.democrat + 2.democrat#`i'.wave, or
		matrix `var'[`i',5] = r(estimate)
		matrix `var'[`i',6] = r(lb)
		matrix `var'[`i',7] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	
	putexcel set results_behavior_ideotrump_noattrition, sheet(ideology) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.ideology + 1.ideology#`i'.wave, or
		matrix `var'[`i',8] = r(estimate)
		matrix `var'[`i',9] = r(lb)
		matrix `var'[`i',10] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.ideology + 2.ideology#`i'.wave, or
		matrix `var'[`i',11] = r(estimate)
		matrix `var'[`i',12] = r(lb)
		matrix `var'[`i',13] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	putexcel set results_behavior_ideotrump_noattrition, sheet(trump) modify
	
	local col = word( "`c(ALPHA)'" , `mod' )
	
	display "`col'1"
	
	putexcel `col'1="`var'"

	forvalues i = 1/6 {
		local resrow = 2*`i'
		local serow = 2*`i'+1
		lincom 1.antitrump + 1.antitrump#`i'.wave, or
		matrix `var'[`i',14] = r(estimate)
		matrix `var'[`i',15] = r(lb)
		matrix `var'[`i',16] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
		local resrow = 2*`i'+13
		local serow = 2*`i'+14
		lincom 2.antitrump + 2.antitrump#`i'.wave, or
		matrix `var'[`i',17] = r(estimate)
		matrix `var'[`i',18] = r(lb)
		matrix `var'[`i',19] = r(ub)
		local est = string(`r(estimate)',"%9.3f")
		local se = string(`r(se)',"%9.3f")
		if r(p) < .05 & r(p) > .01 {
			putexcel `col'`resrow'="`est'*"
		}
		if r(p) < .01 & r(p) > .001 {
			putexcel `col'`resrow'="`est'**"
		}
		if r(p) < .001 {
			putexcel `col'`resrow'="`est'***"
		}
		if r(p) > .05 {
			putexcel `col'`resrow'=`est'
		}
		putexcel `col'`serow'="(`se')"
		
	}
	putexcel save
	
	matrix list `var'


	drop `var'*
	svmat `var'
	
	twoway (connected `var'2 `var'1, msymbol(o)) (connected `var'5 `var'1) (rarea `var'3 `var'4 `var'1, color(gray%20)) (rarea `var'6 `var'7 `var'1, color(gray%20) ///
		name(`var'_d, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrats v Republicans" 2 "Other/Abstain v Republicans")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))
		
	twoway (connected `var'8 `var'1, msymbol(o)) (connected `var'11 `var'1) (rarea `var'9 `var'10 `var'1, color(gray%20)) (rarea `var'12 `var'13 `var'1, color(gray%20) ///
		name(`var'_i, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Liberal v Conservative" 2 "Moderate/Other/Unsure v Conservative")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	twoway (connected `var'14 `var'1, msymbol(o)) (connected `var'17 `var'1) (rarea `var'15 `var'16 `var'1, color(gray%20)) (rarea `var'18 `var'19 `var'1, color(gray%20) ///
		name(`var'_t, replace) title({bf:`l`var''}, size(medsmall)) xtitle("Wave") yline(1, lcolor(black)) xline(308, lcolor(black) lpattern(dot)) ///
		legend(order(1 "Democrat/Biden v Trump" 2 "Other/Abstain v Trump")) yscale(range(.1 125) log) ylabel(.1 1 10) xlabel(1 "1" 32 "2" 89 "3" 138 "4" 200 "5" 370 "6"))

	restore
	
	local mod = `mod'+1

}




grc1leg washhands_d avoidgatherings_d avoidcontact_d soughtinfo_d boughtsanitizer_d selfquarantine_d changedtravel_d visitdoctor_d wearmask_d, rows(3) 
graph export "figureS14.pdf", as(pdf) replace
graph export "figureS14.png", as(png) replace


grc1leg washhands_i avoidgatherings_i avoidcontact_i soughtinfo_i boughtsanitizer_i selfquarantine_i changedtravel_i visitdoctor_i wearmask_i, rows(3) 
graph export "figureS15.pdf", as(pdf) replace
graph export "figureS15.png", as(png) replace


grc1leg washhands_t avoidgatherings_t avoidcontact_t soughtinfo_t boughtsanitizer_t selfquarantine_t changedtravel_t visitdoctor_t wearmask_t, rows(3)
graph export "figureS16.pdf", as(pdf) replace
graph export "figureS16.png", as(png) replace





*** TABLE S7: PARTISANSHIP AND IDEOLOGY AND TRUMPINESS, FIXED EFFECTS


local dvs "washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor wearmask"
local mod=10

preserve 

estimates drop _all
keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w6 race4 inc4 educ4 marstat pid7** anger** anxiety** sadness** hope** disgust**  cases_growth_** deaths_growth_**
	
gen ideology=ideology_w1
gen antitrump=antitrump_w1

reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w anger_w anxiety_w sadness_w hope_w disgust_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

gen allbehaviors = washhands_w+boughtsanitizer_w+visitdoctor_w+changedtravel_w+avoidcontact_w+avoidgatherings_w+soughtinfo_w+selfquarantine_w

pca washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor 
predict behav1


irt 2pl washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor
predict behav2, latent

irt 2pl washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor, group(wave) 
predict behav3, latent


	label values democrat democrat 
	

	xtset caseid wave
	
	tab democrat_w, g(tempdem)
	tab ideology_w, g(tempideo)
	tab antitrump_w, g(temptrump)
	
	tab wave, generate(wave_)


	xtdpdsys allbehaviors temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3 cases_growth_w cases_growth_pc deaths_growth_w deaths_growth_pc, pre(wave_* ) vce(robust)
	eststo allbehaviors
	xtdpdsys behav1 temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3 cases_growth_w cases_growth_pc deaths_growth_w deaths_growth_pc, pre(wave_* ) vce(robust)
	eststo behav1
	xtdpdsys behav2 temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3 cases_growth_w cases_growth_pc deaths_growth_w deaths_growth_pc, pre(wave_* ) vce(robust)
	eststo behav2
	xtdpdsys behav3 temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3 cases_growth_w cases_growth_pc deaths_growth_w deaths_growth_pc, pre(wave_* ) vce(robust)
	eststo behav3

			
restore

 esttab *, keep(temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3) cells(b(fmt(2) nostar) se(fmt(2) par) p(fmt(2)))
 esttab * using table_s7.csv, keep(temptrump2 temptrump3 tempideo2 tempideo3 tempdem2 tempdem3) cells(b(fmt(2) nostar) se(fmt(2) par) p(fmt(2))) csv nogaps replace


 

*** TABLE S8: MODEL SELECTION


putexcel set table_s8, sheet(AIC) replace

putexcel A1="Dependent Variable"
putexcel B1="Partisanship"
putexcel C1="Ideology"
putexcel D1="Trumpism"

putexcel save

putexcel set table_s8, sheet(BIC) modify

putexcel A1="Dependent Variable"
putexcel B1="Partisanship"
putexcel C1="Ideology"
putexcel D1="Trumpism"

putexcel save


local dvs "washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor wearmask"
local i = 2
    
estimates drop _all
foreach var of local dvs {

	preserve 
	
	local l`var' : variable label `var'_w2

	keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**

	reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w antitrump_w ideology_w democrat_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w, i(caseid) j(wave)

	label values democrat democrat 
	
	label var `var' "`l`var''"

	melogit `var' i.democrat##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave  || caseid: 
	estat ic
	matrix ics = r(S)
	putexcel set table_s5, sheet(AIC) modify
	putexcel B`i'= ics[1,5]
	putexcel save
	putexcel set table_s5, sheet(BIC) modify
	putexcel B`i'= ics[1,6]
	putexcel save

	melogit `var' i.ideology##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave  || caseid: 
	estat ic
	matrix ics = r(S)
	putexcel set table_s5, sheet(AIC) modify
	putexcel C`i'= ics[1,5]
	putexcel save
	putexcel set table_s5, sheet(BIC) modify
	putexcel C`i'= ics[1,6]
	putexcel save

	melogit `var' i.antitrump##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave i.inputstate##i.wave i.ruralcode##i.wave c.cases_growth_w##i.wave c.cases_growth_pc##i.wave c.deaths_growth_w##i.wave c.deaths_growth_pc##i.wave  || caseid: 	
	estat ic
	matrix ics = r(S)
	putexcel set table_s5, sheet(AIC) modify
	putexcel D`i'= ics[1,5]
	putexcel save
	putexcel set table_s5, sheet(BIC) modify
	putexcel D`i'= ics[1,6]
	putexcel save

	putexcel set table_s5, sheet(AIC) modify
	putexcel A`i' = `var'
	putexcel save
	putexcel set table_s5, sheet(BIC) modify
	putexcel A`i' = `var'
	putexcel save

	local i = `i'+1
	
	restore
	
}





*** FIGURE S17: DOUBLE SELECTION LASSO

preserve

keep wearmask** washhands** boughtsanitizer** visitdoctor** changedtravel** avoidcontact** avoidgatherings** soughtinfo** selfquarantine** antitrump** ideology** democrat** unemployed** pew_prayer** newsint** state agecat gender race married educ income newsfreq newsattention inputstate ruralcode caseid TrumpShare weight_w5 race4 inc4 educ4 marstat pid7** cases_growth_** deaths_growth_**

reshape long wearmask_w washhands_w boughtsanitizer_w visitdoctor_w changedtravel_w avoidcontact_w avoidgatherings_w soughtinfo_w selfquarantine_w pid7_w unemployed_w pew_prayer_w newsint_w cases_growth_w cases_growth_pc_w deaths_growth_w deaths_growth_pc_w antitrump_w democrat_w ideology_w, i(caseid) j(wave)

label var washhands_w "Washed Hands More"
label var boughtsanitizer_w "Bought Sanitizer"
label var visitdoctor_w "Visited the Doctor"
label var changedtravel_w "Changed Travel Plans"
label var avoidcontact_w "Avoided Contact w/ Others"
label var avoidgatherings_w "Avoided Gatherings"
label var soughtinfo_w "Sought Info on COVID19"
label var selfquarantine_w "Self-Quarantined"
label var wearmask_w "Wear a Mask"

label define antitrump_comp 0 "Base" 1 "Democrat" 2 "3rd Party/Abstain"
label define democrat_comp 0 "Base" 1 "Democrat" 2 "Others"
label define ideology_comp 0 "Base" 1 "Liberal" 2 "Moderate"
  
label values antitrump_w antitrump_comp
label values democrat_w democrat_comp
label values ideology_w ideology_comp


local dvs "washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor wearmask"

foreach var of local dvs {

	local l`var' : variable label `var'_w

	dslogit `var' i.antitrump_w i.democrat_w i.ideology_w, controls(i.inputstate##i.wave i.ruralcode##i.wave i.agecat##i.wave i.unemployed##i.wave i.race4##i.wave i.inc4##i.wave i.educ4##i.wave i.marstat##i.wave i.gender##i.wave)
	
	eststo `var'

	coefplot `var', mcolor(black) ciopts(lwidth(medthick)) xline(1) title({bf:`l`var''}, size(medsmall)) name(`var', replace) eform ///
		headings(1.antitrump_w = "{it:v. Trump}" ///
				 1.democrat_w = "{it:v. Republican}" ///
				 1.ideology_w = "{it:v. Conservative}")

}

graph combine washhands  avoidgatherings avoidcontact soughtinfo boughtsanitizer selfquarantine changedtravel visitdoctor wearmask, xcommon
graph export "figureS17.pdf", as(pdf) replace
graph export "figureS17.png", as(png) replace

restore

